package pl.plesken.tools;

import java.io.File;

public class ListDir {
        StringBuffer str = new StringBuffer();
        
        public String list(String dir) {
                File f = new File(dir);
                
                str.setLength(0);
                
                if (f.exists() && f.isDirectory()) {
                        String[] directories = f.list();
        
                        for (int i = 0; i < directories.length; i++) {
                                File test = new File(dir + File.separator + directories[i]);
                                if (test.isDirectory()) {
                                        if (!directories[i].substring(0, 1).equals(".")) {                                      
                                                if (i == 0) {
                                                        str.append(directories[i]);
                                                } else {
                                                        str.append("," + directories[i]);
                                                }
                                        } 
                                } 
                        } 
                }
                return str.toString();
        }

}
